﻿using System.Web.UI;
using System.Web.UI.WebControls;
using Ue.Framework.Web.WebControls;
using Ue.Infrastructure.Web.UI;
using Ue.Qcdz.Domain.FriendLink;
namespace Ue.Qcdz.UI.Controls.FriendLink
{
    public class FriendLinkEdit : SkinnedEntityEdit<FriendLinks>
    {
        #region Overrides of SkinnedControl

        private string skinFileName = "~/Admin/Themes/Skins/FriendLinks/FriendLinkEdit.ascx";

        private TextBox tbxFileNmae;
        private TextBox tbxFileUrl;
        private TextBox tbxRemark;
        private FriendLinkRadio friendLinkRadio;
        protected override string GetSkinFileName()
        {
            return skinFileName;
        }

        #endregion

        #region Overrides of SkinnedEntityEdit<FriendLinks>

        protected override void InitSkin(Control skin)
        {
            tbxFileNmae = skin.FindControl<TextBox>("tbxFileNmae");
            tbxFileUrl = skin.FindControl<TextBox>("tbxFileUrl");
            tbxRemark = skin.FindControl<TextBox>("tbxRemark");
            friendLinkRadio=skin.FindControl<FriendLinkRadio>("FriendLinkRadio");
        }

        protected override FriendLinks Enttiy
        {
            get
            {
                return new FriendLinks(
                    tbxFileNmae.GetValue<string>(),
                    tbxFileUrl.GetValue<string>(),
                    tbxRemark.GetValue<string>(),
                    friendLinkRadio.SelectedValue,
                    this.EntityKey
                    );
            }
            set
            {
                if(value==null)
                    return;
                tbxFileNmae.SetValue(value.LinkName);
                tbxFileUrl.SetValue(value.LinkUrl);
                tbxRemark.SetValue(value.Remark);
                friendLinkRadio.SelectedValue = value.Status;
            }
        }

        #endregion
    }
}
